package StreamOf;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.stream.Stream;

/**
 * @author zc
 * @version 1.0
 * @date 2021/9/24 11:49
 *
 * 使用 BufferedReader.lines() 方法，将每行内容转成流
 */
public class Test5 {
    public static void main(String[] args) throws FileNotFoundException {
        /*
{"index":{"_id":"1"}}
{"name":"John Doe"}
{"index":{"_id":"2"}}
{"name":"Jane Doe"}
{"index":{"_id":"3"}}
{"name":"John Doe"}
{"index":{"_id":"4"}}
{"name":"John Doe"}

         */
        //读文件
        BufferedReader reader = new BufferedReader(new FileReader("C:\\Users\\Admin\\Desktop\\es_date_1000.txt"));
        Stream<String> lines = reader.lines();
        lines.forEach(System.out::println);
       // System.out.println("----------------");

    }
}
